import React, { PureComponent } from "react";
import ListItem from "./listItem/index";

class ListPage extends PureComponent {
  render() {
    return (
      <>
        {this.props.listData.length === 0 && (
          <div className="text-center">购物车是空的</div>
        )}
        {this.props.listData.map((item) => {
          return (
            <ListItem
              onMinus={this.props.handleMinus}
              onPlus={this.props.handlePlus}
              onDelete={this.props.handleDelete}
              key={item.id}
              data={item}
            />
          );
        })}
      </>
    );
  }
}

export default ListPage;
